import { AppDataSource } from "./data-source"
import { Album } from "./entity/Album";
import { Author } from "./entity/Author";
import { Photo } from "./entity/Photo"
import { PhotoMetadata } from "./entity/PhotoMetaData";
import { User } from "./entity/User"

AppDataSource.initialize().then(async () => {

  // const photoRepository = AppDataSource.getRepository(Photo);
  // const photos = await photoRepository.find();
  // console.log("Loaded photos: ", photos)
  const users = await AppDataSource
    .createQueryBuilder()
    .select("firstname, lastname")
    .from(User, "user")
    .where("user.id = :id OR user.firstname = :name", { id: 10, name: 'Jack' })
    .getRawMany()
  console.log("Loaded users: ", users)

}).catch(error => console.log(error))

